from typing import Callable

import torch
import torchvision.datasets
from torch import nn
from torch.nn import ReLU, Sigmoid
from torch.utils.data import DataLoader
from torch.utils.hooks import RemovableHandle
from torch.utils.tensorboard import SummaryWriter

input = torch.tensor([[1,-0.5],
                      [-1,3]])

input = torch.reshape(input,(-1,1,2,2))


dataset = torchvision.datasets.CIFAR10("../../dataSet",
                                       train=False,
                                       download=True,
                                       transform=torchvision.transforms.ToTensor())

dataLoader = DataLoader(dataset,64)

class Ah(nn.Module):

    def __init__(self):
        super().__init__()
        self.relu1 = ReLU()

    def forward(self,input):
        output = self.relu1(input)
        return output


ah = Ah()

writer = SummaryWriter("../logs")
step = 0
for data in dataLoader:
    imags ,tables =data
    print(imags.shape)
    writer.add_images("relu_in",imags,step)
    output = ah(imags)
    writer.add_images("relu_out",output,step)
    step += 1


writer.close()
